package core

import (
	"demo/conf"

	"github.com/go-redis/redis"
)

var RedisClient *redis.Client

func InitCache() {
	client := redis.NewClient(&redis.Options{
		Addr:     conf.RedisAddr,
		Password: conf.RedisPwd,
		DB:       int(conf.RedisDbName),
	})
	_, err := client.Ping().Result()
	if err != nil {
		panic("redis 连接错误")
	}
	RedisClient = client
}
